home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / utility / 252 / gemsrc / text.def < prev    next >
Text File  |  1988-02-13  |  4KB  |  97 lines

  1. DEFINITION MODULE Text;
  2.  
  3.  
  4.    (* This package defines the String80 abstract data type and lists  *)
  5.    (* the operations possible on Text.String objects.  Note that the  *)
  6.    (* Text.String data type is defined as ARRAY [0..n] OF CHAR, where *)
  7.    (* n is the largest possible length of the string.  Since the      *)
  8.    (* length of a string may vary dynamically, strings are terminated *)
  9.    (* by the Null character.                                          *)
  10.    (*                                                                 *)
  11.    (* Note: Since all strings have the same representation regardless *)
  12.    (* of length, the operations provided by this module may be used   *)
  13.    (* on strings of any length.                                       *)
  14.  
  15.  
  16.    TYPE String80 = ARRAY [0..80] OF CHAR;
  17.    TYPE StringPtr = POINTER TO String80;
  18.  
  19.       (* These types define a varying length string with a maximum *)
  20.       (* length of 80 characters.                                  *)
  21.  
  22.  
  23.    PROCEDURE Length ( VAR Source : (* IN *) ARRAY OF CHAR ) : CARDINAL;
  24.  
  25.       (* Return the current length of the string. *)
  26.  
  27.  
  28.    PROCEDURE Assign (
  29.       VAR Source      : (* IN  *) ARRAY OF CHAR;
  30.       VAR Destination : (* OUT *) ARRAY OF CHAR );
  31.  
  32.       (* Assign the source string to the destination.  If the *)
  33.       (* length of source exceeds the length of Destination,  *)
  34.       (* the source string is truncated.                      *)
  35.  
  36.  
  37.    TYPE CompareResult = ( LessThan, Equal, GreaterThan );
  38.  
  39.    PROCEDURE Compare (
  40.       VAR LeftString  : (* IN *) ARRAY OF CHAR;
  41.       VAR RightString : (* IN *) ARRAY OF CHAR ) : CompareResult;
  42.  
  43.       (* Compare the contents of LeftString with that of RightString *)
  44.       (* using the ASCII collating sequence.                         *)
  45.  
  46.  
  47.    PROCEDURE SliceChar (
  48.       VAR Source : (* IN  *) ARRAY OF CHAR;
  49.       Position   : (* IN  *) CARDINAL;
  50.       VAR Result : (* OUT *) CHAR ) : BOOLEAN;
  51.  
  52.       (* Slice the character indicated by Position out of the string *)
  53.       (* contained in Source.  This routine returns FALSE if the     *)
  54.       (* position exceeds the current length of the String, or TRUE  *)
  55.       (* otherwise.                                                  *)
  56.  
  57.  
  58.    PROCEDURE SliceString (
  59.       VAR Source : (* IN  *) ARRAY OF CHAR;
  60.       Start      : (* IN  *) CARDINAL;
  61.       Stop       : (* IN  *) CARDINAL;
  62.       VAR Result : (* OUT *) ARRAY OF CHAR ) : BOOLEAN;
  63.  
  64.       (* Slice the string indicated by the range Start..Stop from   *)
  65.       (* the source string.  This routine returns FALSE if Start is *)
  66.       (* greater than Stop, if Stop exceeds the current length of   *)
  67.       (* the string, or if the slice length exceeds the length of   *)
  68.       (* Result.  Otherwise, TRUE is returned.                      *)
  69.  
  70.  
  71.    PROCEDURE ConcatChar (
  72.       VAR Source : (* IN  *) ARRAY OF CHAR;
  73.       Character  : (* IN  *) CHAR;
  74.       VAR Result : (* OUT *) ARRAY OF CHAR ) : BOOLEAN;
  75.  
  76.       (* Concatenate Character onto the end of Source.  This routine *)
  77.       (* returns FALSE if the resulting string exceeds the length of *)
  78.       (* Result, or TRUE otherwise.                                  *)
  79.  
  80.  
  81.    PROCEDURE ConcatString (
  82.       VAR LeftString  : (* IN  *) ARRAY OF CHAR;
  83.       VAR RightString : (* IN  *) ARRAY OF CHAR;
  84.       VAR Result      : (* OUT *) ARRAY OF CHAR ) : BOOLEAN;
  85.  
  86.       (* Concatenate RightString onto the end of LeftString.  This *)
  87.       (* routine returns FALSE is the resulting string exceeds the *)
  88.       (* length of Result, or TRUE otherwise.                      *)
  89.  
  90.  
  91.    PROCEDURE UpperCase ( VAR String : (* IN *) ARRAY OF CHAR );
  92.  
  93.       (* Convert a string into all uppercase *)
  94.  
  95.  
  96. END Text.
  97.